#include "aicommandphrase.h"

namespace IAlib
{

AiCommandPhrase::AiCommandPhrase()
{
    AiCommand::setType(AiCommand::COMMAND_DIALOG_PHRASE);
}

QByteArray AiCommandPhrase::toByteArray() const
{
    QByteArray byte_array;
    QDataStream data(&byte_array, QIODevice::WriteOnly);

    data<<getMode();
    data<<getIdOrigine();
    data<<getIdTarget();
    data<<getPhraseId();

    return byte_array;
}

void AiCommandPhrase::fromByteArray(QByteArray &byte_array)
{
    QDataStream data(&byte_array, QIODevice::ReadOnly);
    int i_temp;
    QString s_temp;

    data>>i_temp;
    setMode((AiCommand::CommandMode)i_temp);
    data>>s_temp;
    setIdOrigine(s_temp);
    data>>s_temp;
    setIdTarget(s_temp);
    data>>m_phrase_id;
}

}
